//
//  TEXMLObjectViewController.m
//  TintExample
//
//  Created by Kevin Wu on 2/27/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import "TEXMLObjectViewController.h"

#import "TEAlbum.h"

#import "TEBook.h"

#import "TEApple.h"
#import "TEGrape.h"

#import "TEResponse.h"



@implementation TEXMLObjectViewController


#pragma mark - UIViewController

- (void)loadView {
    [super loadView];
    
    [self addButtonWithTitle:@"parse Bookshelf" selector:@selector(parseBookshelf:)];
    [self addButtonWithTitle:@"parse Garden" selector:@selector(parseGarden:)];
    [self addButtonWithTitle:@"parse Response" selector:@selector(parseResponse:)];
    [self addButtonWithTitle:@"parse Locker" selector:@selector(parseLocker:)];
    [self addButtonWithTitle:@"parse Misc" selector:@selector(parseMisc:)];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [NSArray mapToNodeName:@"bookshelf"];
    [TEBook mapToNodeName:@"book"];
    
    [NSArray mapToNodeName:@"garden"];
    [TEApple mapToNodeName:@"apple"];
    [TEGrape mapToNodeName:@"grape"];
    
    [TEResponse mapToNodeName:@"response"];
    [TEUser mapToNodeName:@"user"];
    [TEBirthday mapToNodeName:@"birthday"];
    
    [NSArray mapToNodeName:@"locker"];
    [NSArray mapToNodeName:@"albums"];
    [TEAlbum mapToNodeName:@"album"];
    [NSDictionary mapToNodeName:@"date"];
    [NSArray mapToNodeName:@"images"];
    
    
//    [NSObject setClass:[NSArray class] forNodeName:@"bookshelf"];
//    [NSObject setClass:[TEBook class] forNodeName:@"book"];
//    
//    [NSObject setClass:[NSArray class] forNodeName:@"garden"];
//    [NSObject setClass:[TEApple class] forNodeName:@"apple"];
//    [NSObject setClass:[TEGrape class] forNodeName:@"grape"];
//    
//    [NSObject setClass:[TEResponse class] forNodeName:@"response"];
//    [NSObject setClass:[TEUser class] forNodeName:@"user"];
//    [NSObject setClass:[TEBirthday class] forNodeName:@"birthday"];
//    
//    [NSObject setClass:[NSArray class] forNodeName:@"locker"];
//    [NSObject setClass:[NSArray class] forNodeName:@"albums"];
//    [NSObject setClass:[TEAlbum class] forNodeName:@"album"];
//    [NSObject setClass:[NSDictionary class] forNodeName:@"date"];
//    [NSObject setClass:[NSArray class] forNodeName:@"images"];
}




- (void)parseBookshelf:(id)sender {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"bookshelf.xml" ofType:nil];
    NSData *data = [NSData dataWithContentsOfFile:path];
    
    NSArray *result = [NSArray objectWithXMLData:data];
    NSLog(@"%@", result);
}

- (void)parseGarden:(id)sender {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"garden.xml" ofType:nil];
    NSData *data = [NSData dataWithContentsOfFile:path];
    
    NSArray *result = [NSArray objectWithXMLData:data];
    NSLog(@"%@", result);
}

- (void)parseResponse:(id)sender {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"response.xml" ofType:nil];
    NSData *data = [NSData dataWithContentsOfFile:path];
    
    TEResponse *result = [TEResponse objectWithXMLData:data];
    NSLog(@"%@", result);
}

- (void)parseLocker:(id)sender {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"locker.xml" ofType:nil];
    NSData *data = [NSData dataWithContentsOfFile:path];
    
    NSArray *result = [NSArray objectWithXMLData:data];
    NSLog(@"%@", result);
}

- (void)parseMisc:(id)sender {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"misc.xml" ofType:nil];
    NSData *data = [NSData dataWithContentsOfFile:path];
    
    NSArray *result = [NSArray objectWithXMLData:data];
    NSLog(@"%@", result);
}

@end
